package com.lsu.command.experiment;

import javax.swing.*;

/**
 * 具体的观察者实现_检测圆的位置
 *
 * @Author wang suo
 * @Date 2020/10/21 0021 15:08
 * @Version 1.0
 */
public class ConcreteObserverCircleLoc extends JLabel implements Observer {

    ConcreteObserverCircleLoc() {
        super("新增圆点位于: (0,0)");
    }

    @Override
    public void update(Integer n, Integer x, Integer y) {
        if (n == 1) {
            this.setText("新增圆点位于: (" + x + "," + y + ")");
        } else if (n == 2) {
            this.setText("删除圆点位于: (" + x + "," + y + ")");
        }
    }
}
